package cn.youruan.demo.utils;


import cn.youruan.demo.common.CustomException;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

@Setter
@Getter
public class AssertUtils {

    public static void hasText(String text,String message) {
        if (!StringUtils.hasText(text)) {
            throw new CustomException(message);
        }
    }

    public static void isTrue(Boolean expression,String message) {
        if (!expression) {
            throw new CustomException(message);
        }
    }

    public static void notNull(Object obj, String msg) {
        if (obj ==null) {
            throw new CustomException(msg);
        }
    }
}
